package cn.hrlly.tao2shou.presenter;

import cn.hrlly.tao2shou.biz.OrderDetailsBiz;
import cn.hrlly.tao2shou.biz.OrderDetailsBizImpl;
import cn.hrlly.tao2shou.domain.Order;
import cn.hrlly.tao2shou.domain.Orders;
import cn.hrlly.tao2shou.listener.OnOrderDetailsListener;
import cn.hrlly.tao2shou.view.view_interface.OrderDetailsView;

/**
 * User: gengliang
 * Date: 2016-01-31
 * Time: 18:48
 */

public class OrderDetailsPresenterImpl implements OrderDetailsPresenter,OnOrderDetailsListener {

    private OrderDetailsBiz orderDetailsBiz;
    private OrderDetailsView orderDetailsView;

    public OrderDetailsPresenterImpl(OrderDetailsView orderDetailsView) {
        this.orderDetailsView = orderDetailsView;
        this.orderDetailsBiz=new OrderDetailsBizImpl(this);
    }

    @Override
    public void showOrderDetails() {
        Orders orders=new Orders();
        orders.setOrderId(orderDetailsView.getOrderId());
        orderDetailsBiz.getOrderDetails(orders);
    }

    @Override
    public void showOrderDetailsSucc(Order order) {
        orderDetailsView.showOrderDetails(order);
    }

    @Override
    public void showOrderDetailsFail(String errorMessage) {
        orderDetailsView.showMessage(errorMessage);
    }

    @Override
    public void showOrderDetailsFail(int errorMessage) {
        orderDetailsView.showMessage(errorMessage);
    }
}
